# -*- coding: utf-8 -*-  
import sys, time
import send_email, send_slack

def example_slack():
    now = time.time()
    channel = 'test-api'
    attachments = [
        {
            "pretext": "--------------", 
            "author_name": "Unassigned",  
            "title": "open:0 | On Hold:0 | OverDue:0", 
            "title_link": "https://api.slack.com/",
            "text": "You are good.\nAnd i am good too :smile:.", 
            "color":"#7CD197",
            "footer": "Slack API",
            "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
            "ts": int(now)
        }
    ]
    msg = 'Hi <!here> <@miragelu>, this is ME Notification'

    send_slack.send_slack(channel, msg, attachments)

def example_email():
    html = [
        "<center><h1>Example Email Title</h1></center>",
        """
        <p><b>A standard paragraph.</b></p>
        <ol>
            <li>This demonstrates a list.</li>
        </ol>
        """
    ]
    html.extend([
        "<br>"
        " Some more",
        "<p>items go here</p>"
    ])
    from_addr = "miragelu@seekasia.com"
    to_addrs = [
        "miragelu@seekasia.com",
        "person2@gmail.com"
    ]
    subject = "A Example Email"
    
    send_email.send_email(from_addr, to_addrs, subject, html)

if __name__ == "__main__":
    args = sys.argv[1:]
    if not args:
        print("not args")
    else:
        param1 = args[0]

    start_time = time.time()

    #example_slack()
    #example_email()
    
    end_time = time.time()
    print("total run time: %f" % (end_time - start_time))
